CC = gcc 
LD = ld
CFLAGS = -g

all: assember xvm

#$@--目标文件 $^--所有的依赖文件 $<--第一个依赖文件
assember: assember.o tool/stringtinylib.o tool/linklistlib.o instruction.o constants.h instruction.h function.h
	$(CC) $(CFLAGS)  -o $@ $^

xvm: xvm.o tool/stringtinylib.o tool/linklistlib.o instruction.o constants.h instruction.h function.h
	$(CC) $(CFLAGS)  -o $@ $^ -lm

%.o: %.c constants.h instruction.h function.h
	$(CC) $(CFLAGS) -c -o $@ $<

tool/%.o: tool/%.c tool/%.h constants.h
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -rf *.o tool/*.o assember xvm
